using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

namespace QUAN_LY_NGAN_HANG_CAU_HOI_TRAC_NGHIEM
{
    public class MucDoDAL
    {
        private Guid _maSoMucDo;

        public Guid MaSoMucDo
        {
            get { return _maSoMucDo; }
            set { _maSoMucDo = value; }
        }

        private string _chuThich;

        public string ChuThich
        {
            get { return _chuThich; }
            set { _chuThich = value; }
        }

        public static List<MucDoDAL> ListMucDo()
        {
            var lst = new List<MucDoDAL>();
            using (var con = new SqlConnection(Globals.ConnectionString))
            {
                var cmd = new SqlCommand("usp_LayTatCaMucDo", con);
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                IDataReader rd = cmd.ExecuteReader();
                if (rd != null)
                {
                    while (rd.Read())
                    {
                        var cn = new MucDoDAL();
                        cn.MaSoMucDo = (Guid)rd["MaSoMucDo"];
                        cn.ChuThich = (string)rd["ChuThich"];
                        lst.Add(cn);
                    }
                }
            }
            return lst;
        }
    }
}